/*
结构体指针
*/
# include <stdio.h>

struct weapon
	{
		char name[10];
		float price;
		int len;	
	};
struct weap{
	int price;
	int atk;
	struct weap * next;
};

int main(int argc, char const *argv[])
{
	


	struct weapon weapon1={"china",90.00,6};
	struct weapon weapon2[2]={{"china1",90.00,6},{"china2",90.01,7}};
	// weapon1.name="china";
	// weapon1.price=90.00;
	// weapon1.len=6;
	//结构体指针
	struct weapon *w;
	w=&weapon1;
	printf("(*w).name=%s\n", (*w).name);
	printf("w->name=%s\n", w->name);
	printf("weapon1.name=%s\n", weapon1.name);

	printf("===================================\n");
	struct weapon * p;
	p=weapon2;
	printf("%s\n",p->name);//weapon2[0].name
	p++;//weapon2[1]
	printf("%s\n",p->name);//weapon2[1].name

	printf("===================================\n");
	struct weap a,b,c,*head;
	a.price=100;
	a.atk=100;
	b.price=200;
	b.atk=200;
	c.price=300;
	c.atk=300;
	head=&a;
	a.next=&b;
	b.next=&c;
	c.next=NULL;

	struct weap * q;
	q=head;
	while(q!=NULL){
		printf("%d,%d\n",q->atk,q->price);
		q=q->next;
	}
	return 0;
}